<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>管理</title>
    <script type="text/javascript" src="../common/jquery-3.2.1.js"></script>
    <link rel="stylesheet" href="../common/common.css" type="text/css">
    <script type="text/javascript" src="../common/commonManager.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            if (manager.type == "ADMIN") {
                $("#adminOptions").show();
                $("#managerNameDiv").html("超级管理员：" + manager.name);
            } else {
                $("#adminOptions").hide();
                $("#managerNameDiv").html("普通管理员：" + manager.name);
            }
            changeDetailWindowUrl("ider.html")
        });

        function changeDetailWindowUrl(newUrl) {
            $("#detailWindow").attr("src", newUrl);
        }

        function logout() {
            $.ajax({
                url: "../manager/main/logout",
                data: {},
                async: false,
                success: function (ajaxResult) {
                    if (ajaxResult.success) {
                        manager = null;
                        window.top.location.href = "login.html";
                    } else {
                        alert("失败，原因：" + ajaxResult.message);
                    }
                },
                error: function () {
                    alert("请求服务失败");
                }
            });
        }
    </script>
</head>
<body>
<div id="logout">
    <span id="managerNameDiv"></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" onclick="logout()" value="退出">
</div>
<br><br><br>
<div>
    <table width="100%" height="1000px">
        <tr>
            <td width="20%" valign="top">
                <table align="right">
                    <tr>
                        <td>
                            <button onclick='changeDetailWindowUrl("ider.html")'>首页</button>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <div id="adminOptions" style="display:none;">
                                <table>
                                    <tr>
                                        <td>
                                            <button onclick='changeDetailWindowUrl("manager.html")'>管理员</button>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <button onclick='changeDetailWindowUrl("relation.html")'>管理员与id关联
                                            </button>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <button onclick='changeDetailWindowUrl("myself.html")'>
                                修改个人信息
                            </button>
                        </td>
                    </tr>
                </table>
            </td>
            <td width="80%">
                <iframe id="detailWindow" src="" width="100%" height="100%"></iframe>
            </td>
        </tr>
    </table>
</div>
</body>
</html>